package com.ansion.user.listener;

import android.text.TextUtils;

import androidx.annotation.NonNull;

import com.ansion.basetool.preconditions.Preconditions;


/**
 * @author john on 2021/7/14.
 * @version 1.0
 * @desc 联系人，群信息，broadcast，公众号资料变更通知
 */
public abstract class ContactChangeListener extends BaseContactChangeListener {
    public static final String ALL = "All";
    protected String uid;

    public ContactChangeListener() {
    }

    public ContactChangeListener(@NonNull String uid) {
        Preconditions.checkNotEmpty(uid);
        this.uid = uid;
    }

    public boolean match(@NonNull String uid) {
        return TextUtils.equals(ALL, this.uid) || TextUtils.equals(uid, this.uid);
    }

    final public void init(String userUid) {
        Preconditions.checkNotEmpty(userUid);
        this.uid = userUid;
    }

    public String getUid() {
        return uid;
    }
}
